﻿Jxstar.currentPage = function() {
	var config = {param:{},initpage:function(page, define){},eventcfg:{}};

	var auditData = Jxstar.findComboData('audit');
	var authtypeData = Jxstar.findComboData('authtype');
	var moneytypeData = Jxstar.findComboData('moneytype');

	var cols = [
	{col:{header:'记录状态', width:84, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: auditData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: auditData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < auditData.length; i++) {
				if (auditData[i][0] == value)
					return auditData[i][1];
			}
		}}, field:{name:'project_mplan__auditing',type:'string'}},
	{col:{header:'项目编号', width:100, sortable:true}, field:{name:'project_mplan__project_code',type:'string'}},
	{col:{header:'项目名称', width:250, sortable:true}, field:{name:'project_mplan__project_name',type:'string'}},
	{col:{header:'授权形式', width:100, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: authtypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: authtypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < authtypeData.length; i++) {
				if (authtypeData[i][0] == value)
					return authtypeData[i][1];
			}
		}}, field:{name:'project_mplan__auth_type',type:'string'}},
	{col:{header:'编制日期', width:100, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'project_mplan__plan_date',type:'date'}},
	{col:{header:'编制人', width:78, sortable:true}, field:{name:'project_mplan__plan_user',type:'string'}},
	{col:{header:'实施部门', width:100, sortable:true}, field:{name:'project_mplan__dept_name',type:'string'}},
	{col:{header:'项目负责人', width:84, sortable:true}, field:{name:'project_mplan__project_user',type:'string'}},
	{col:{header:'计划说明', width:310, sortable:true}, field:{name:'project_mplan__plan_memo',type:'string'}},
	{col:{header:'主键', width:100, sortable:true, hidden:true}, field:{name:'project_mplan__mplan_id',type:'string'}},
	{col:{header:'实施部门id', width:100, sortable:true, hidden:true}, field:{name:'project_mplan__dept_id',type:'string'}},
	{col:{header:'编制人id', width:100, sortable:true, hidden:true}, field:{name:'project_mplan__plan_userid',type:'string'}},
	{col:{header:'项目负责人id', width:100, sortable:true, hidden:true}, field:{name:'project_mplan__project_userid',type:'string'}},
	{col:{header:'项目ID', width:100, sortable:true, hidden:true}, field:{name:'project_mplan__project_id',type:'string'}},
	{col:{header:'项目类别', width:100, sortable:true, hidden:true, align:'center',
		renderer:function(value){
			for (var i = 0; i < moneytypeData.length; i++) {
				if (moneytypeData[i][0] == value)
					return moneytypeData[i][1];
			}
		}}, field:{name:'project_mplan__money_type',type:'string'}}
	];
	
	config.param = {
		cols: cols,
		sorts: null,
		hasQuery: '1',
		isedit: '0',
		isshow: '1',
		funid: 'project_mplan'
	};
	
	config.eventcfg = {		selPlan: function(){			var records = this.grid.getSelectionModel().getSelections();			if (!JxUtil.selectone(records)) return;						var mplanId = records[0].get('project_mplan__mplan_id');			var frm = Ext.get('frmGantt_Plan').dom.contentWindow;			frm.App.Gantt.reloadData(mplanId);						var parent = this.grid.ownerCt;			if (parent.isXType('window')) parent.close();		}
	};		config.initpage = function(gridNode){		var grid = gridNode.page;		grid.on('rowdblclick', function(g, n, e) {			gridNode.event.selPlan();		});	};
		
	return new Jxstar.GridNode(config);
}